describe('Move transaction password', function(){
	var moveTransactionPwdController = null;

    beforeEach(function(){


        var t_alertCtrl = App.AlertController.create();
        var t_loadingCtrl = App.LoadingController.create();
        var t_moveHolderCtrl = App.MoveHolderController.create();
        App.MoveTransactionPwdController.reopen({

            init:function(){
                this.set('controllers.alert', t_alertCtrl);
                this.set('controllers.loading', t_loadingCtrl);
                this.set('controllers.moveHolder', t_moveHolderCtrl);
            }
        });

        moveTransactionPwdController = App.MoveTransactionPwdController.create();

    });

    describe("controller unit test", function(){

        beforeEach(function(){
            var transfer = App.BillPayment.create();
            transfer.isPostDateAllowed = false;
            spyOn(App.getSession(),'getCurrentTransfer').andReturn(transfer);
        });

        it("prepareController unit test", function(){
    		spyOn(moveTransactionPwdController, 'set');
    		moveTransactionPwdController.prepareController();
    		expect(App.getSession().getCurrentTransfer).toHaveBeenCalled();
    		expect(moveTransactionPwdController.transactionPassword).toEqual('');
        });

        it('continueAction unit test', function(){
        	spyOn(moveTransactionPwdController, 'hasError');
        	spyOn(App.api_transfer, 'confirmTransfer');
        	moveTransactionPwdController.set('transactionPassword', '');

        	moveTransactionPwdController.continueAction();
        	expect(moveTransactionPwdController.hasError).toHaveBeenCalled();

        	moveTransactionPwdController.set('transactionPassword', 'ibnk1357');
        	moveTransactionPwdController.continueAction();
        	expect(App.api_transfer.confirmTransfer).toHaveBeenCalled();
        });

        it('confirmTransferCallback', function(){
        	spyOn(moveTransactionPwdController, 'hasError');
        	spyOn(moveTransactionPwdController, 'transitionTo');
        	moveTransactionPwdController.confirmTransferCallback();
            expect(moveTransactionPwdController.transitionTo).toHaveBeenCalledWith('move.confirm');
        });


    });

});